home *** CD-ROM | disk | FTP | other *** search
/ Nebula 2 / Nebula Two.iso / SourceCode / MiscKit1.7.1 / MiscKit / Palettes / MiscThreeStateButton / MiscThreeStateButton.subproj / MiscThreeStateButtonCell.h < prev    next >
Encoding:
Text File  |  1995-04-13  |  2.9 KB  |  94 lines

  1. //
  2. //    MiscThreeStateButtonCell.h -- cell class for the three state button
  3. //        Written by Don Yacktman Copyright (c) 1993 by Don Yacktman.
  4. //                Version 1.0.  All rights reserved.
  5. //
  6. //        This notice may not be removed from this source code.
  7. //
  8. //        This is a free object!  Contact the author for the latest version.
  9. //        Don Yacktman, 4279 N. Ivy Lane, Provo, UT, 84604
  10. //        e-mail:  Don_Yacktman@byu.edu
  11. //
  12. //    This object is included in the MiscKit by permission from the author
  13. //    and its use is governed by the MiscKit license, found in the file
  14. //    "LICENSE.rtf" in the MiscKit distribution.  Please refer to that file
  15. //    for a list of all applicable permissions and restrictions.
  16. //    
  17.  
  18. #import <appkit/appkit.h>
  19.  
  20. // The three state button...
  21.  
  22. // the values of these are arbitrary and chosen to avoid conflict
  23. // with the NeXT #defines in ButtonCell.h...  use them with -setType:
  24. #define MISC_CYCLIC_THREE_STATE    100    // cycles through three states
  25. #define MISC_PLAIN_THREE_STATE    101    // alt click for third state
  26.  
  27. @interface MiscThreeStateButtonCell:ButtonCell
  28. {
  29.     char *thirdTitle;    // title for the third state
  30.     id _thirdImage;        // image for the third state
  31.     char *trueAltTitle;    // title for the third state
  32.     id _trueAltImage;    // image for the third state
  33.     BOOL isCyclic;        // if not, ALT click gives third state.
  34.     BOOL thirdState;    // if we're in the third state.
  35.     BOOL altClicked;
  36.     BOOL dontIncrement;
  37. }
  38.  
  39. // the basics
  40. - init;
  41. - copyFromZone:(NXZone *)zone;
  42. - free;
  43.  
  44. // override to set the "true" instance variables...
  45. - (const char *)altTitle;
  46. - setAltTitle:(const char *)aString;
  47. - (const char *)altIcon;
  48. - setAltIcon:(const char *)iconName;
  49. - altImage;
  50. - setAltImage:image;
  51.  
  52. // setting and getting the third image/title
  53. - (const char *)thirdTitle;
  54. - setThirdTitle:(const char *)aString;
  55. - (const char *)thirdIcon;
  56. - setThirdIcon:(const char *)iconName;
  57. - thirdImage;
  58. - setThirdImage:image;
  59. - setType:(int)aType;
  60. - (BOOL)isCyclic;
  61.  
  62. // Need to override these to provide for the third state
  63. - (const char *)stringValue;
  64. - setStringValue:(const char *)aString;
  65. - setStringValueNoCopy:(const char *)aString;
  66. - (int)intValue;
  67. - setIntValue:(int)anInt;
  68. - (float)floatValue;
  69. - setFloatValue:(float)aFloat;
  70. - (double)doubleValue;
  71. - setDoubleValue:(double)aDouble;
  72.  
  73. // these override the drawing to deal with the extra
  74. // image/icon and title
  75. - getDrawRect:(NXRect *)theRect;
  76. - getTitleRect:(NXRect *)theRect;
  77. - getIconRect:(NXRect *)theRect;
  78. - calcCellSize:(NXSize *)theSize inRect:(const NXRect *)aRect;
  79. - drawInside:(const NXRect *)aRect inView:controlView;
  80. - highlight:(const NXRect *)cellFrame inView:controlView lit:(BOOL)flag;
  81. - (BOOL)trackMouse:(NXEvent *)theEvent inRect:(const NXRect *)cellFrame
  82.         ofView:controlView;
  83. - performClick:sender;
  84. - performAltClick:sender;
  85. - write:(NXTypedStream *)stream;
  86. - read:(NXTypedStream *)stream;
  87.  
  88. - replaceAltTitle:(const char *)aString;
  89. - replaceTitle:(const char *)aString;
  90.  
  91. - incrementState;
  92. - setHighlightsBy:(int)aType;
  93. @end
  94.